Added trap for ERR, to get better response from the scripts when they are really
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Tue, 29 Nov 2005 14:56:54 +0000 (14:56 +0000)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Tue, 29 Nov 2005 14:56:54 +0000 (14:56 +0000)
broken, and add do_or_die command.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/examples/xen-hotplug-common.sh

index 9cce5175a21917bd59e74b12a797ac513269b2f4..2d9fd9da04472c14329f386fbcfeae175f074a38 100644 (file)
@@ -40,6 +40,17 @@ success() {
   xenstore_write "$XENBUS_PATH"/hotplug-status connected
 }
 
+do_or_die() {
+  "$@" || fatal "$@ failed"
+}
+
+sigerr() {
+  fatal "$0" "$@" "failed; error detected."
+}
+
+trap sigerr ERR
+
+
 ##
 # xenstore_read <path>+
 #